﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes {

    public class TimestampEvents {

        public static const TIME_NONE:int = 0;
        public static const TIME_CHRISTMAS2010:int = 1;
        public static const TIME_CHRISTMAS2010_WARNING:int = 2;
        public static const TIME_CHRISTMAS2010_END:int = 3;
        public static const TIME_COUNT:int = 4;
        private static const m_TimestampData_ID:int = 0;
        private static const m_TimestampData_TEXTID:int = 1;
        private static const m_TimestampData_TIMESTAMPDATA:int = 2;

        private static var m_TimestampData:Array = new Array(new Array(TIME_NONE, "none", "2010:12:01:00:00:00"), new Array(TIME_CHRISTMAS2010, "christmas2010", "2010:12:24:18:00:00"), new Array(TIME_CHRISTMAS2010_WARNING, "christmas2010_warning", "2011:01:03:00:00:00"), new Array(TIME_CHRISTMAS2010_END, "christmas2010_end", "2011:01:08:00:00:00"));

        private static function getTimestmpDataFromID(_arg1:String):String{
            var _local2:int;
            while (_local2 < TIME_COUNT) {
                if (_arg1 == m_TimestampData[_local2][m_TimestampData_TEXTID]){
                    return (m_TimestampData[_local2][m_TimestampData_TIMESTAMPDATA]);
                };
                _local2++;
            };
            return ("");
        }
        private static function parseDateFromTimestampID(_arg1:String):Date{
            var _local2:Date = new Date(0, 0, 0, 0, 0, 0, 0);
            var _local3:Array = getTimestmpDataFromID(_arg1).split(":");
            if (_local3.length == 6){
                _local2 = new Date(parseInt(_local3[0]), (parseInt(_local3[1]) - 1), parseInt(_local3[2]), parseInt(_local3[3]), parseInt(_local3[4]), parseInt(_local3[5]), 0);
            };
            return (_local2);
        }
        private static function parseDateFromTimestampString(_arg1:String):Date{
            var _local2:Date = new Date(0, 0, 0, 0, 0, 0, 0);
            var _local3:Array = _arg1.split(":");
            if (_local3.length == 6){
                _local2 = new Date(parseInt(_local3[0]), (parseInt(_local3[1]) - 1), parseInt(_local3[2]), parseInt(_local3[3]), parseInt(_local3[4]), parseInt(_local3[5]), 0);
            };
            return (_local2);
        }
        public static function checkCurrentTimeBeforeTime(_arg1:int):Boolean{
            if ((((_arg1 < TIME_NONE)) && ((_arg1 >= TIME_COUNT)))){
                return (false);
            };
            var _local2:Date = parseDateFromTimestampID(Global.player.currentTimestampEventID);
            var _local3:Date = parseDateFromTimestampString(m_TimestampData[_arg1][m_TimestampData_TIMESTAMPDATA]);
            if (_local2 < _local3){
                return (true);
            };
            return (false);
        }
        public static function checkCurrentTimeBeforeOrDuringTime(_arg1:int):Boolean{
            if ((((_arg1 < TIME_NONE)) && ((_arg1 >= TIME_COUNT)))){
                return (false);
            };
            var _local2:Date = parseDateFromTimestampID(Global.player.currentTimestampEventID);
            var _local3:Date = parseDateFromTimestampString(m_TimestampData[_arg1][m_TimestampData_TIMESTAMPDATA]);
            if (_local2 <= _local3){
                return (true);
            };
            return (false);
        }
        public static function checkLastTimeAfterOrDuringTime(_arg1:int):Boolean{
            if ((((_arg1 < TIME_NONE)) && ((_arg1 >= TIME_COUNT)))){
                return (false);
            };
            var _local2:Date = parseDateFromTimestampID(Global.player.previousTimestampEventID);
            var _local3:Date = parseDateFromTimestampString(m_TimestampData[_arg1][m_TimestampData_TIMESTAMPDATA]);
            if (_local2 >= _local3){
                return (true);
            };
            return (false);
        }
        public static function checkCurrentTimeAfterOrDuringTime(_arg1:int):Boolean{
            if ((((_arg1 < TIME_NONE)) && ((_arg1 >= TIME_COUNT)))){
                return (false);
            };
            var _local2:Date = parseDateFromTimestampID(Global.player.currentTimestampEventID);
            var _local3:Date = parseDateFromTimestampString(m_TimestampData[_arg1][m_TimestampData_TIMESTAMPDATA]);
            if (_local2 >= _local3){
                return (true);
            };
            return (false);
        }
        public static function checkLastTimeAfterTime(_arg1:int):Boolean{
            if ((((_arg1 < TIME_NONE)) && ((_arg1 >= TIME_COUNT)))){
                return (false);
            };
            var _local2:Date = parseDateFromTimestampID(Global.player.previousTimestampEventID);
            var _local3:Date = parseDateFromTimestampString(m_TimestampData[_arg1][m_TimestampData_TIMESTAMPDATA]);
            if (_local2 > _local3){
                return (true);
            };
            return (false);
        }
        public static function checkCurrentTimeAfterTime(_arg1:int):Boolean{
            if ((((_arg1 < TIME_NONE)) && ((_arg1 >= TIME_COUNT)))){
                return (false);
            };
            var _local2:Date = parseDateFromTimestampID(Global.player.currentTimestampEventID);
            var _local3:Date = parseDateFromTimestampString(m_TimestampData[_arg1][m_TimestampData_TIMESTAMPDATA]);
            if (_local2 > _local3){
                return (true);
            };
            return (false);
        }
        public static function checkLastTimeBetweenRange(_arg1:int, _arg2:int):Boolean{
            if ((((_arg1 < TIME_NONE)) && ((_arg1 >= TIME_COUNT)))){
                return (false);
            };
            if ((((_arg2 < TIME_NONE)) && ((_arg2 >= TIME_COUNT)))){
                return (false);
            };
            var _local3:Date = parseDateFromTimestampID(Global.player.previousTimestampEventID);
            var _local4:Date = parseDateFromTimestampString(m_TimestampData[_arg1][m_TimestampData_TIMESTAMPDATA]);
            var _local5:Date = parseDateFromTimestampString(m_TimestampData[_arg2][m_TimestampData_TIMESTAMPDATA]);
            if ((((_local3 >= _local4)) && ((_local3 < _local5)))){
                return (true);
            };
            return (false);
        }
        public static function checkTimestampAfterUnixTime(_arg1:String, _arg2:Number):Boolean{
            var _local3:Date = parseDateFromTimestampString(_arg1);
            var _local4:Date = new Date(_arg2);
            if ((((_local3.time <= 0)) || ((_local4.time <= 0)))){
                return (false);
            };
            return ((_local3.time > _local4.time));
        }
        public static function checkCurrentTimeBetweenRange(_arg1:int, _arg2:int):Boolean{
            if ((((_arg1 < TIME_NONE)) && ((_arg1 >= TIME_COUNT)))){
                return (false);
            };
            if ((((_arg2 < TIME_NONE)) && ((_arg2 >= TIME_COUNT)))){
                return (false);
            };
            var _local3:Date = parseDateFromTimestampID(Global.player.currentTimestampEventID);
            var _local4:Date = parseDateFromTimestampString(m_TimestampData[_arg1][m_TimestampData_TIMESTAMPDATA]);
            var _local5:Date = parseDateFromTimestampString(m_TimestampData[_arg2][m_TimestampData_TIMESTAMPDATA]);
            if ((((_local3 >= _local4)) && ((_local3 < _local5)))){
                return (true);
            };
            return (false);
        }
        public static function checkCurrentTimeAfterOrDuringTime_FirstTimeOnly(_arg1:int):Boolean{
            if (((checkCurrentTimeAfterOrDuringTime(_arg1)) && (!(checkLastTimeAfterOrDuringTime(_arg1))))){
                return (true);
            };
            return (false);
        }
        public static function checkCurrentTimeAfterTime_FirstTimeOnly(_arg1:int):Boolean{
            if (((checkCurrentTimeAfterTime(_arg1)) && (!(checkLastTimeAfterTime(_arg1))))){
                return (true);
            };
            return (false);
        }
        public static function checkCurrentTimeBetweenRange_FirstTimeOnly(_arg1:int, _arg2:int):Boolean{
            if (((checkCurrentTimeBetweenRange(_arg1, _arg2)) && (!(checkLastTimeBetweenRange(_arg1, _arg2))))){
                return (true);
            };
            return (false);
        }
        public static function isCurrentTimeBetweeenRange(_arg1:String, _arg2:String):Boolean{
            var _local3:Date;
            var _local4:Date;
            if (_arg1){
                _local3 = parseDateFromTimestampString(_arg1);
            };
            if (_arg2){
                _local4 = parseDateFromTimestampString(_arg2);
            };
            var _local5:Date = new Date();
            if (((_local3) && (_local4))){
                return ((((_local5.time >= _local3.time)) && ((_local5.time <= _local4.time))));
            };
            if (_local4){
                return ((_local5.time <= _local4.time));
            };
            if (_local3){
                return ((_local5.time >= _local3.time));
            };
            return (false);
        }
        public static function get hasTimestampEventChanged():Boolean{
            return (!((Global.player.currentTimestampEventID == Global.player.previousTimestampEventID)));
        }

    }
}//package Classes 
